{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1}\n",
      "{1, 2}\n"
     ]
    }
   ],
   "source": [
    "def add_to_set(element, my_set=set()):\n",
    "    my_set.add(element)\n",
    "    return my_set\n",
    "\n",
    "print(add_to_set(1))  # 输出: {1}\n",
    "print(add_to_set(2))  # 可能期望输出: {2}, 实际输出: {1, 2}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "unsupported operand type(s) for |: 'set' and 'dict'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[3], line 3\u001b[0m\n\u001b[1;32m      1\u001b[0m s1 \u001b[38;5;241m=\u001b[39m {\u001b[38;5;241m1\u001b[39m}\n\u001b[1;32m      2\u001b[0m s2 \u001b[38;5;241m=\u001b[39m {}\n\u001b[0;32m----> 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43ms1\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m|\u001b[39;49m\u001b[43m \u001b[49m\u001b[43ms2\u001b[49m)\n",
      "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for |: 'set' and 'dict'"
     ]
    }
   ],
   "source": [
    "s1 = {1}\n",
    "s2 = {}\n",
    "print(s1 | s2)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "jupter-env-10",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
